﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace danalyser.Interface.Forms
{
    using Controllers;

    /// <summary>
    /// Окно ожидания
    /// </summary>
    public partial class splashForm : Form
    {
        public splashForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Выполняемая операция
        /// </summary>
        public string Operation { get { return OperationLabel.Text; } set { OperationLabel.Text = value; this.Update(); } }

        public new void Show()
        {
            FormController.Instance.Main.Enabled = false;
            this.TopMost = true;
            base.Show();
        }

        public new void Hide()
        {
            FormController.Instance.Main.Enabled = true;
            while (this.Visible)
            {
                this.TopMost = true;
                base.Hide();
            }
        }

        /// <summary>
        /// Отображение окна по центру другого окна
        /// </summary>
        /// <param name="Form">окно - родитель</param>
        public void ShowInCenterOf(Form Form)
        {
            this.Left = Form.Left + Form.Width / 2 - this.Width / 2;
            this.Top = Form.Top + Form.Height / 2 - this.Height / 2;
            this.Show();
            this.Update();
        }
    }
}
